#include <QApplication>
#include <QObject>
#include <QDeclarativeContext>
#include <QGraphicsObject>
#include <QDebug>
#include <QIcon>
#include "qmlapplicationviewer.h"
#include "worktool.h"

Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    QmlApplicationViewer viewer;
    WorkTool tool;
    viewer.rootContext()->setContextProperty("workTool", &tool);
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/BackupRestoreTool/main.qml"));
    //viewer.showExpanded();
    QObject *root = qobject_cast<QObject*>(viewer.rootObject());
    QObject::connect(&tool, SIGNAL(showProc(QVariant)), root, SLOT(showProc(QVariant)));
    QObject::connect(&tool, SIGNAL(showSpeed(QVariant)), root, SLOT(showSpeed(QVariant)));
    QObject::connect(&tool, SIGNAL(showOptDev(QVariant)), root, SLOT(showOptDev(QVariant)));
    QObject::connect(&tool, SIGNAL(showSpendTime(QVariant)), root, SLOT(showSpendTime(QVariant)));
    QObject::connect(&tool, SIGNAL(showRemainingTime(QVariant)), root, SLOT(showRemainingTime(QVariant)));
    viewer.setWindowIcon(QIcon("./restore-normal.png"));
    viewer.showFullScreen();

    return app->exec();
}
